package com.acidsweet.zerolrucache.core;

/**
 * Created by jin on 16/10/20.
 */

public abstract class ILruCache {

    protected int mMaxSize=0;
    protected int mVolume=0;

    abstract public void init();

    public long getMaxSize() {
        return mMaxSize;
    }

    public void setMaxSize(int mMaxSize) {
        this.mMaxSize = mMaxSize;
    }

    public long getVolume() {
        return mVolume;
    }

    public void setVolume(int mVolume) {
        this.mVolume = mVolume;
    }

    abstract public void put(String key,byte[] value,OnEventListener listener);
    abstract public void get(String key,OnEventListener listener);
    abstract public void clear(OnEventListener listener);
    abstract public void exist(String key,OnEventListener listener);
    abstract public void remove(String key,OnEventListener listener);

    protected void OnActionSucc(OnEventListener listener,CacheEvent event)
    {
        if(listener!=null)
            listener.onEventSucc(event);
    }
    protected  void OnActionFail(OnEventListener listener,Exception error)
    {
        if(listener!=null)
            listener.onEventFail(error);
    }
}
